package com.lyj.friend.controller.file;

import com.lyj.common.core.controller.BaseController;
import com.lyj.common.core.domain.R;
import com.lyj.file.domain.OSSResult;
import com.lyj.friend.service.file.FileService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LIUYANJIAO
 * Date: 2025-09-15
 * Time: 19:28
 */
@RestController
@RequestMapping("/file")
public class FileController extends BaseController {

    @Resource(name = "fileServiceImpl")
    private FileService fileService;

    @PostMapping("/upload")
    public R<OSSResult> upload(@RequestBody MultipartFile file) {
        return R.ok(fileService.upload(file));
    }
}
